package com.atguigu.heap;

import com.atguigu.utils.ArrayGenerator;
import com.atguigu.utils.SortingHelper;
import org.junit.Test;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class SortTest {

    public static void main(String[] args) {
        int n=1000000;
        Integer[] arr1 = ArrayGenerator.generateRandomArray(n, n);
        Integer[] arr2 = Arrays.copyOf(arr1,arr1.length);
        Integer[] arr3 = Arrays.copyOf(arr1,arr1.length);
        Integer[] arr4 = Arrays.copyOf(arr1,arr1.length);
        Integer[] arr5 = Arrays.copyOf(arr1,arr1.length);
        SortingHelper.sortTest("MergeSort",arr1);
        SortingHelper.sortTest("QuickSort",arr2);
        SortingHelper.sortTest("HeapSort",arr3);
        SortingHelper.sortTest("QuickSort3Ways",arr4);
        SortingHelper.sortTest("HeapSort2",arr5);
    }
    @Test
    public void test1(){
        Integer[]data={89,56,34,90,23,17,45,34};
        HeapSort.Sort2(data);
        System.out.println(Arrays.toString(data));
        Map<Integer,Integer> map_index=new HashMap<>();
        System.out.println(map_index.getOrDefault(1,0));
    }
}
